/***************************************************************************
 *   Copyright (C) 2004, 2005 by tonton                                    *
 *   tontonNOSPAM@team1664.org                                             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef INTERNAL_H
#define INTERNAL_H

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#ifdef __BCC__
#define __CLIB
#else
#  ifdef __DMC__
#    define __CLIB  __cdecl
#  else
#    define __CLIB  cdecl
#  endif
#  ifndef __SMALL__
#     error you must compile with small memory model
#  endif
#endif

#ifdef __BCC__
#define _DS __get_ds()
/*FIXME: this is not correct, but how to get a far pointer with bcc ? */
#define FAR(x) MK_FP(_DS, x)
#else
#ifdef __DMC__
#define _DS getDS()
#define FAR(x) (x)
#endif
#endif

#ifndef uint32_t
typedef unsigned long uint32_t;
#endif

#ifndef uint16_t
typedef unsigned short uint16_t;
#endif

#ifndef uint8_t
typedef unsigned char uint8_t;
#endif

#ifdef __BCC__
#define FARPTR uint32_t
#define MK_FP(seg,offset) ((uint32_t)(((uint32_t)(seg)<<16) | (uint16_t)(offset)))
#else
#include <dos.h>
#  ifdef __DMC__
#    define FARPTR void __far *
#  else
#    define FARPTR void far *
#  endif
#endif

#ifdef __BCC__
#  define const
#endif

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

#endif /*INTERNAL_H*/

